<include file="Public/header"/>
<include file="Public/menu"/>

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            微信设置
            <small>二维码列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 微信设置</a></li>
            <li class="active">二维码列表</li>
        </ol>
    </section>
    <!-- 内容 -->
    <section class="content">

        <div class="tab-content">
            <div class="tab-pane active" id="tab_0">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title"></h3>
                        <div class="form-inline pull-right">
                            <form action="{:U('Weixin/twoDBarcode')}" method="get" pjax-container="">
                                <fieldset>
                                    <select class="form-control" name="select" style="height: 30px; font-size: 12px;">
                                        <option value="id" <if condition="$select eq 'id' "> selected = "selected"</if>>ID</option>
                                        <option value="store_name" <if condition="$select eq 'store_name' "> selected = "selected"</if>>门店名称</option>
                                        <option value="barcode_name" <if condition="$select eq 'barcode_name' "> selected = "selected"</if>>二维码名称</option>
                                    </select>
                                    <div class="input-group input-group-sm">
                                        <div class="input-group input-group-sm">
                                            <input type="text" class="form-control" placeholder="" name="value" value="{$value}">
                                        </div>
                                    </div>

                                    <div class="input-group input-group-sm">
                                        <div class="input-group-btn">
                                            <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i>
                                            </button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>

                       <!-- <div class="btn-group pull-right" style="margin-right: 10px">
                            <a href="/admin/sakila/actors?_pjax=%23pjax-container&amp;_export=1" target="_blank"
                               class="btn btn-sm btn-warning"><i class="fa fa-download"></i>&nbsp;&nbsp;Export</a>
                        </div>-->

                        <div class="btn-group pull-right" style="margin-right: 10px">
                            <a href="{:U('Weixin/newTwoDBarcode')}" class="btn btn-sm btn-success"><i
                                    class="fa fa-save"></i>&nbsp;&nbsp;新增一个二维码配置</a>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tbody>
                            <tr>
                                <th><input type="checkbox" class="grid-select-all"></th>
                                <th>ID<a id="a_order" rank='{$rank}' onclick="rankId('id','{$rank}')" class="fa fa-fw fa-sort" href="javascript:void(0);"></a>
                                </th>
                                <th>二维码名称</th>
                                <th>二维码图片</th>
                                <th>二维码参数</th>
                                <th>门店</th>
                                <th>状态</th>

                                <th>备注</th>
                                <th>生成时间</th>
                                <th>操作</th>
                            </tr>
                            <foreach name="list" item="vo" >
                                <tr>
                                    <td><input type="checkbox" class="grid-item" data-id="{$vo.barcode_id}"></td>
                                    <td>{$vo.barcode_id}</td>
                                    <td>{$vo.barcode_name}</td>
                                    <td><img style='-webkit-user-select: none; cursor: zoom-in;' src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={$vo.barcode_img}" width='50' height='50'></td>
                                    <td>{$vo.b_parameter}</td>
                                    <td>{$vo.local_name}</td>
                                    <td>{:search(array('失效','正常','冻结'),$vo['status'])}</td>

                                    <td>{$vo.remark}</td>
                                    <td>{$vo.regtime|date='Y-m-d H:i:s',###}</td>
                                    <td>
                                        <a href="{:U('Weixin/saveTwoDBarcode',['id'=>$vo[barcode_id]])}" class="btn btn-sm btn-primary grid-refreshe">编辑</a>&nbsp;&nbsp;
                                        <a href="javascript:void(0);" name="{$vo[barcode_img]}" class="btn btn-sm btn-primary grid-refreshe suggest">查看图片</a>&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </foreach>

                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <!--<input type="checkbox" class="grid-select-all">&nbsp;&nbsp;&nbsp;
                        <a class="btn btn-sm btn-danger batch-delete">Batch delete</a>-->
                        {$page}
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>
    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer"/>
<script src="/Public/layer/layer.js"></script>
<script>
    ;!function(){
        $('.suggest').on('click', function(){
            var img = $(this).attr('name');
            layer.ready(function(){
                layer.open({
                    type: 2,
                    title: '查看图片',
                    fix: false,
                    maxmin: true,
                    shadeClose: true,
                    area: ['600px', '600px'],
                    content: "{:U('Weixin/lookTwoDBarcode')}?img="+img,
                    end: function(){
                        layer.tips('Hi', '#about', {tips: 1})
                    }
                });
            });
        });
    }();

    var rankId = function(ran,order){
        window.location.href="{:U('Weixin/twoDBarcode')}"+"?select={$select}&value={$value}&"+ran+"="+order;
    }
</script>